var express = require('express');
var router = express.Router();
const {
    // 新增车位
    addParking,
    // 获取车位数据
    getParkinData,
    // 删除车位
    deleteParking,
    // 获取需要修改车位的数据
    getUpdateParking,
    // 传送修改车位的数据
    postUpdateParking,
    // 修改车位状态
    updateParkingState,
} = require("../service/parkingsService")

//  新增车位
router.post('/addParking', async function (req, res, next) {
    res.send(await addParking(req.body))
});
// 获取车位数据

router.post('/getParkinData', async function (req, res, next) {
    console.log(1111, req.body);
    res.send(await getParkinData(req.body))
});
// 删除车位

router.post('/deleteParking', async function (req, res, next) {
    res.send(await deleteParking(req.body))
});
// 获取需要修改车位的数据

router.post('/getUpdateParking', async function (req, res, next) {
    res.send(await getUpdateParking(req.body))
});
// 传送修改车位的数据

router.post('/postUpdateParking', async function (req, res, next) {
    console.log(req.body);
    res.send(await postUpdateParking(req.body))
});
// 修改车位状态的
router.post('/updateParkingState', async function (req, res, next) {
    res.send(await updateParkingState(req.body))
});



module.exports = router;
